//
//  NewClunInfoCell.m
//  Shengzhuli
//
//  Created by FXGuo on 2018/1/11.
//  Copyright © 2018年 kamangkeji. All rights reserved.
//

#import "NewClunInfoCell.h"
#import "UnderLineBtn.h"
#import "MBProgressHUD+MJ.h"

@interface NewClunInfoCell()

@property (weak, nonatomic) IBOutlet UnderLineBtn *introBtn;
@property (weak, nonatomic) IBOutlet UnderLineBtn *AcBtn;
@property (nonatomic,strong) UnderLineBtn *lastBtn;

@property (weak, nonatomic) IBOutlet UIView *conView;
@property (weak, nonatomic) IBOutlet UIImageView *icovView;
@property (weak, nonatomic) IBOutlet UILabel *desLab;
@property (weak, nonatomic) IBOutlet UILabel *nameLab;
@property (weak, nonatomic) IBOutlet UILabel *keepLab;//关注数
@property (weak, nonatomic) IBOutlet UILabel *funsLab;
@property (weak, nonatomic) IBOutlet UILabel *acLab;
@property (weak, nonatomic) IBOutlet UIButton *foucsBtn;


@property (weak, nonatomic) IBOutlet NSLayoutConstraint *iconWidthCons;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *iconHeightCons;

@end

@implementation NewClunInfoCell

- (void)awakeFromNib {
    [super awakeFromNib];
    if (ScreenH == 568.00) {
        self.iconWidthCons.constant = 80;
        self.iconHeightCons.constant = 80;
        self.icovView.layer.cornerRadius = 40;
        self.conView.layer.cornerRadius = 43;
        self.nameLab.font = Font(16);
        self.desLab.font = Font(14);
        self.introBtn.titleLabel.font = Font(16);
        self.AcBtn.titleLabel.font = Font(16);
    }
    self.introBtn.selected = YES;
    self.lastBtn = self.introBtn;
}

- (IBAction)btnClick:(UnderLineBtn *)btn
{
    if (btn == self.lastBtn) return;
    self.lastBtn = btn;
    if (btn == self.introBtn) {
        self.introBtn.selected = YES;
        self.AcBtn.selected = NO;
    }else {
        self.introBtn.selected = NO;
        self.AcBtn.selected = YES;
    }
    if (self.selectBlockClick) {
        self.selectBlockClick(btn.tag);
    }
}
- (IBAction)introBtnClick:(UIButton *)btn
{
    if (self.introBlockClick) {
        self.introBlockClick();
    }
}
- (IBAction)focusClick:(UIButton *)btn
{
    if (self.focusClickBlock) {
        self.focusClickBlock(btn);
    }
}

- (void)setModel:(ClubModel *)model
{
    _model = model;
    [self.icovView sd_setImageWithURL:[NSURL URLWithString:model.clubLogo] placeholderImage:GetImage(@"club_icon")];
    self.nameLab.text = model.clubName;
    self.keepLab.text = [NSString stringWithFormat:@"%zd",model.keepCount];
    self.funsLab.text = [NSString stringWithFormat:@"%zd",model.fans];
    self.desLab.text = model.content;
    self.acLab.text = [NSString stringWithFormat:@"发布过%@个活动,累计参加人数%@人",model.activityCount,model.activityPersonCount];
    if (model.keepStatus == 1) {
        self.foucsBtn.selected = YES;
        self.foucsBtn.backgroundColor = RGBColorOne(180);
    }else {
        self.foucsBtn.selected = NO;
        self.foucsBtn.backgroundColor = RGBColor(78, 188, 65);
    }
}


@end
